package com.nuoniu.sibanyun.controller.erp.in;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.dto.ExistQuantityDto;
import com.nuoniu.sibanyun.entity.dto.InInventoryInfoDto;
import com.nuoniu.sibanyun.entity.dto.InInventoryInfoSearchDto;
import com.nuoniu.sibanyun.entity.vo.InInventoryCheckSearchVo;
import com.nuoniu.sibanyun.service.erp.in.IInInventoryInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * <p>
 * 库存信息 前端控制器
 * </p>
 *
 * @author baiqiang
 * @since 2020-09-22
 */
@RestController
@RequestMapping("/in/inventoryInfo")
@Api(value = "仓库信息", tags = "仓库信息")
public class InInventoryInfoController extends BaseController {

    @Autowired
    private IInInventoryInfoService inInventoryInfoService;


    /**
     * 获取仓库信息列表
     * @date 2020-09-25
     */
    @GetMapping("pageList")
    @ApiOperation("获取仓库信息列表")
    public HttpResult pageList(Page page, InInventoryInfoDto inInventoryInfoDto) {
        return HttpResult.ok(inInventoryInfoService.pageList(page, inInventoryInfoDto));
    }

    @GetMapping("pageInInventoryCheckSearchVo")
    @ApiOperation(" 盘点业务 查询现存量")
    public HttpResult<InInventoryCheckSearchVo> pageInInventoryCheckSearchVo(Page page, InInventoryInfoSearchDto inInventoryInfoSearchDto) {
        return HttpResult.ok(inInventoryInfoService.pageInInventoryCheckSearchVo(page, inInventoryInfoSearchDto));
    }

    @GetMapping("getInInventoryCheckSearchVo")
    @ApiOperation(" 盘点业务 查询现存量(单个查询)")
    public HttpResult<InInventoryCheckSearchVo> inInventoryCheckSearchVo(Long warehouseId,String inventoryCode) {
        return HttpResult.ok(inInventoryInfoService.inInventoryCheckSearchVo(warehouseId, inventoryCode));
    }


    @PostMapping("getExistQuantityByWarehouseId")
    @ApiOperation("根据 物料ID 和 仓库ID  获取现存量")
    public HttpResult getExistQuantityByWarehouseId(@RequestBody ExistQuantityDto existQuantityDto) {
        return HttpResult.ok(inInventoryInfoService.getExistQuantityByWarehouseId(existQuantityDto));
    }

}
